<include file="Public:head" title='用户详情' />
<script src="__PUBLIC__/js/other/validate.js"></script>
<script type="text/javascript">
    $(function() {
//        checkFengting();
        var id = '{$detail.id}';
        var id_url = '';
        if (id > 0) {
            id_url = "/id/" + id + "";
        }
        var mobile = $('#mobile').val();
        jQuery.validator.addMethod("isMobile", function(value, element) {
            var length = value.length;
            var mobile = /^1[3,5,8]\d{9}$/;
            return (length == 11 && mobile.exec(value)) ? true : false;
        }, "请正确填写您的手机号码");
        $("#form").validate({
            errorPlacement: function(error, element) {
                var error_td = element.parent('td');
                error_td.find('label.error').hide();
                error_td.append(error);
            },
            rules: {
                name: {
                    required: true,
                    minlength: 3,
                    maxlength: 15,
                    remote: {
                        url: '__APP__/{$Think.MODULE_NAME}/Ajax/check_name' + id_url,
                        type: 'post',
                        data: {
                            name: function() {
                                return $('#name').val();
                            }
                        }
                    }
                },
                pwd: {
                    minlength: 6,
                    maxlength: 20
                },
                email: {
                    email: true,
                    remote: {
                        url: '__APP__/{$Think.MODULE_NAME}/Ajax/check_email' + id_url,
                        type: 'post',
                        data: {
                            email: function() {
                                return $('#email').val();
                            }
                        }
                    }
                },
                phone: {
//                    isMobile  : true,
                    remote: {
                        url: '__APP__/{$Think.MODULE_NAME}/Ajax/check_mobile' + id_url,
                        type: 'post',
                        data: {
                            phone: function() {
                                return $('#phone').val();
                            }
                        }
                    }
                }

            },
            messages: {
                name: {
                    required: '用户名不能为空',
                    minlength: '用户名必须在3-15个字符之间',
                    maxlength: '用户名必须在3-15个字符之间',
                    remote: '该用户名已经存在'
                },
                pwd: {
                    minlength: '密码长度应在6-20个字符之间',
                    maxlength: '密码长度应在6-20个字符之间'
                },
                email: {
                    email: '这不是一个有效的电子邮箱',
                    remote: '该电子邮箱已经存在'
                },
                phone: {
                    isMobile: "请输入有效的手机号码",
                    remote: '该手机号码已经存在'
                }

            }
        });
    });
    function checkFengting() {
        var check = $("input[name=state]:checked").val();
        if (check == 0) {
            $('#fengting').hide();
        } else {
            $('#fengting').show();
        }
    }
    function get_invite_code() {
        $.post("__APP__/Ajax/get_invite_code", {},
                function(data) {
                    $("#invite_code").val(data);
                })
    }
    function zengtui_table() {
        $("#modal_zengsong").modal('toggle');
    }
    function zengtui_confirm(obj) {
    var modal = obj.parents(".modal");
    var id = $("#id").val();
     var points = $("#zengtui_points").val();
     var plus_minus = $("#zengtui_plus_minus").val();
     var type = $("#zengtui_type").val();
    $.post(obj.attr("data-url"), {
        id: id,
        points:points,
        plus_minus:plus_minus,
        type:type
        
    }, function(data) {
        location.reload();
    })
}
    
</script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('User/lists')}">用户管理</a></li>
                    <li class="active">用户{$Think.get.id|getPageType}</li>
                </ul>
            </div>
            <form id="form" enctype="multipart/form-data" method="POST" action="{:U('User/detail_post')}">
                <div class="page-content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="row">
                                <div class="col-xs-12">
                                    <h3 class="header smaller lighter blue">用户{$Think.get.id|getPageType}</h3>


                                    <table class="table table_detail">
                                        <tbody>
                                            <tr>
                                                <td class="td_left">用户名:</td>
                                                <td>
                                                    {$detail.name}   
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">昵称:</td>
                                                <td>
                                                    {$detail.nickname}
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">金额:</td>
                                                <td>
                                                    积分：{$detail.money}   火币：{$detail.huobi}
                                                    <a class="red" data-toggle="modal"  onclick="zengtui_table()"data-rel="tooltip" data-original-title="赠送或退币">赠送或退币</a>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">QQ:</td>
                                                <td>
                                                    {$detail.qq_num}
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">密码:</td>
                                                <td>
                                                    <input class="common_txt" type="text" value="" name="pwd" id="pwd" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">安全码:</td>
                                                <td>
                                                    <input class="common_txt" type="text" value="" name="pwd_pay" id="pwd_pay" />
                                                </td>
                                            </tr>
                                           
                                            <!--                            <tr>
                                                                            <td class="td_left">手机号:</td>
                                                                            <td>
                                                                                <input class="common_txt" type="text" value="{$detail.phone}" name="phone"id="phone" />
                                                                            </td>
                                                                        </tr>-->
                                            <tr>
                                                <td class="td_left">email:</td>
                                                <td>
                                                    <input class="common_txt" type="text" value="{$detail.email}" name="email" id="email"/>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td class="td_left">校验码:</td>
                                                <td>
                                                    <input class="common_txt" type="text" value="" name="verify" />
                                                </td>
                                            </tr>
                                            <!--                            <tr>
                                                                            <td class="td_left">邀请码:</td>
                                                                            <td>
                                                                                <input class="common_txt" type="text" value="{$detail.invite_code}" name="invite_code" id="invite_code"/>
                                                                                <button class="btn btn-sm" type="button" onclick="get_invite_code()">随机获取</button>
                                                                            </td>
                                                                        </tr>-->

                                        <if  condition="$detail.id gt 0">
                                            <tr>
                                                <td class="td_left">注册时间:</td>
                                                <td>
                                                    {$detail.addtime|date="Y-m-d H:i",###}
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">最后登录时间:</td>
                                                <td>
                                                    {$detail.logintime|date="Y-m-d H:i",###}
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">最后登录ip:</td>
                                                <td>
                                                    {$detail.loginip}
                                                </td>
                                            </tr>
                                            <!--                                <tr>
                                                                                <td class="td_left">是否封停:</td>
                                                                                <td>
                                                                                    <input type="radio" name="state" value="0"onclick="checkFengting()" autocomplete="off" 
                                                                            <if condition="$detail.state eq 0">checked</if>> 否
                                                                            <input type="radio" name="state" value="1" onclick="checkFengting()" autocomplete="off" 
                                                                                   <if condition="$detail.state eq 1">checked</if>> 是
                                                                            </td>
                                                                            </tr>
                                                                            <tr id="fengting" style="display: none">
                                                                                <td class="td_left">封停原因:</td>
                                                                                <td>
                                                                                    <textarea style="width:410px;height:50px;" name="reason">{$log.reason}</textarea>
                                                                                </td>
                                                                            </tr>-->
                                        </if>
                                        <tr>
                                            <td class="td_left"></td>
                                            <td>
                                                <input type='hidden' name='id' value='{$Think.get.id}' id="id" data="{$detail.pwd_safe}"/>

                                                <button class="btn btn-info btn-sm" type="submit">
                                                    <i class="icon-ok bigger-110 "></i>
                                                    保 存
                                                </button>

                                                <button class="btn btn-sm reset" type="button" onclick="goUrl(-1)">
                                                    <i class="icon-undo bigger-110"></i>
                                                    返 回
                                                </button>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="modal fade" id="modal_zengsong">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel">赠送或退币</h4>
                        </div>
                        <div class="modal-body">
                            <table>
                                <tr>
                                    <td class="td_left">加减类型:</td>
                                    <td>
                                        <select name="zengtui_plus_minus" id="zengtui_plus_minus" autocomplete="off">

                                            <option value="1">赠送</option>
                                            <option value="0">退币</option>
                                            </foreach>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_left">虚拟币类型:</td>
                                    <td>
                                        <select name="zengtui_type"  id="zengtui_type" autocomplete="off">

                                            <option value="1">火币</option>
                                            <option value="0">积分</option>
                                            </foreach>
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td class="td_left">火币:</td>
                                    <td>
                                        <input class="common_txt" style="width:100px" type="text" value="" name="zengtui_points" id="zengtui_points"/>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-danger btn-xs ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false" onclick="zengtui_confirm($(this))" data-url="{:U('Ajax/zengtui_confirm')}">
                                <span class="ui-button-text">
                                    <i class="icon-trash bigger-110"></i>
                                    确 定
                                </span>
                            </button>
                            <button class="btn btn-xs ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false" data-dismiss="modal">
                                <span class="ui-button-text">
                                    <i class="icon-remove bigger-110"></i>
                                    取 消
                                </span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>
<include file="Public:foot" />